﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;


typedef struct
{
	int m;
}Context;
Context context = { 0 };

int prime(int n)
{
	if (n < 2)
		return 0;
	if (n < 4)
		return 1;
	if (n % 2 == 0)
		return 0;
	int s = sqrt(n) + 1;
	for (int i = 3; i < s; i += 2)
		if (n % i == 0)
			return 0;
	return 1;
}

void read_data(Context* ctx)
{
	scanf("%d", &ctx->m);
}


void solve(Context* ctx)
{
	int count = 0;
	for (int i = ctx->m - 1; i >= 2; --i) {

		if (prime(i))
		{
			printf("%6d", i);
			if (++count == 10)
				break;
		}
	}
	printf("\n");
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-181.txt", "r", stdin);
	read_data(&context);
	solve(&context);
	return 0;
}
